﻿
@{
    ViewBag.Title = "View";
}

<h2>会员中心</h2>
<br />
<div>当前用户名:@ViewBag.UserName</div>
<button id="logout">退出登录</button>
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
<script>
    $("#logout").click(function ()
    {
        $.ajax(
            {
                type: "post",
                url:"/User/LoginOut",
                headers:
                {
                    "auth": "@Html.Raw(ViewBag.Token)"
                },
                success: function (res) {
                    if (res.suc == 0) {
                        alert("退出成功");
                        location.href = "/user";
                    }
                }
            })
    })
</script>